<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<script type="text/javascript">
	function popUpMember(value){
			var url = '/SomeTalk/adminMemberDetail.do?id='+value;
			open(url,'회원세부정보','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=390,height=500'); 
		}
	function popUpBlack(value){
			var url = '/SomeTalk/adminBlackDetail.do?num='+value;
			open(url,'블랙리스트 세부정보','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=390,height=500'); 
		}
</script>

<div class="container">
<div id="info">
	<h2><img src="./image/title_img22.jpg"/></h2>
</div>

	<div class="adminForm">
		<div id="adminHeader">
			<ul class="nav nav-tabs">
				<c:if test="${type==1 }">
					<li class="col-xs-6 col-sm-2 col-md-2 col-lg-2"><a href="#tabs" data-toggle="tab" onclick="location.href='/SomeTalk/adminMember.do'"><img src="./image/title_img25.jpg"></a></li>
					<li class="col-xs-6 col-sm-2 col-md-2 col-lg-2 active"><a href="#tabs" data-toggle="tab" onclick="location.href='/SomeTalk/adminBlack.do'"><img src="./image/title_img26.jpg"></a></li>
				</c:if>
				<c:if test="${type==2 }">
					<li class="col-xs-6 col-sm-2 col-md-2 col-lg-2 active"><a href="#tabs" data-toggle="tab" onclick="location.href='/SomeTalk/adminMember.do'"><img src="./image/title_img25.jpg"></a></li>
					<li class="col-xs-6 col-sm-2 col-md-2 col-lg-2"><a href="#tabs" data-toggle="tab" onclick="location.href='/SomeTalk/adminBlack.do'"><img src="./image/title_img26.jpg"></a></li>
				</c:if>
			</ul>
		</div>
		
		<div id="adminBody">
			<div class="tab-content">
				<div class="tab-pane active" id="tabs">
					<c:if test="${type==2 }">
						
						<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 searchs">
							<form action="/SomeTalk/adminMember.do" action="get" class="form-inline searchForm" role="form">
								<select class="col-xs-4 col-sm-5 col-md-5 col-lg-5 form-control input-sm" name="keyField">
									<option value="all">전체</option>
									<option value="name">이름</option>
									<option value="gender">성별</option>
									<option value="id">아이디</option>
								</select>
								<input type="text" class="col-xs-5 col-sm-5 col-md-5 col-lg-5 form-control input-sm" name="keyWord">
								<button type="submit" class="col-xs-3 col-sm-2 col-md-2 col-lg-2 btn btn-default btn-sm">검색</button>
							</form>
						</div>
						
						<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" align="center">
							<table class="table table-hover table-white">
								<tr>
									<th>등급(상태)</th>
									<th>번호</th>
									<th>아이디</th>
									<th>비밀번호</th>
									<th>이름</th>
									<th>성별</th>
								</tr>
								<c:forEach var="member" items="${memberList }"> 
									<tr>
										<td>
											<c:if test="${member.grade == 0}">
												0 (운영자)
											</c:if>
											<c:if test="${member.grade == 1}">
												1 (정상 회원)
											</c:if>
											<c:if test="${member.grade == 8}">
												<font color="red">8 (정지 회원)</font>
											</c:if>
											<c:if test="${member.grade == 9}">
												9 (탈퇴회원)
											</c:if>
										</td>
										<td>${memberNum }</td>
										<c:set var="memberNum" value="${memberNum-1 }"/>
										<td><span class="clickAdmin" onclick="popUpMember(this.id)" id="${member.id }">${member.id }</span></td>											
										<td>${member.password }</td>
										<td>${member.name }</td>
										<td>${member.gender }</td>
									</tr>
								</c:forEach>
							</table>
						</div>
						
						<div class="col-xs-12 col-sm-12 col-md-12 pagings" align="center">
							<div class="form-group">
								<div class="row">
									<div class="col-xs-12">${memberPaging }</div>
								</div>
							</div>
						</div>
					</c:if>
				
				
					<c:if test="${type==1 }">
						<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 searchs" align="center">
							<form action="/SomeTalk/adminBlack.do" action="get" class="form-inline searchForm" role="form">
								<select class="col-xs-4 col-sm-5 col-md-5 col-lg-5 form-control input-sm" name="keyField">
									<option value="all">전체</option>
									<option value="suspect">가해자</option>
									<option value="victim">피해자</option>
									<option value="content">내용</option>
								</select>
								<input type="text" class="col-xs-5 col-sm-5 col-md-5 col-lg-5 form-control input-sm" name="keyWord">
								<button type="submit" class="col-xs-3 col-sm-2 col-md-2 col-lg-2 btn btn-default btn-sm">검색</button>
							</form>
						</div>
						
						<div class="col-xs-12 col-sm-12 col-md-12" align="center">
						<table class="table table-hover table-white">
								<tr>
									<th>번호</th>
									<th>가해자</th>
									<th>피해자</th>
									<th>내용</th>
									<th>날짜</th>
								</tr>
								<c:forEach var="black" items="${blackList }"> 
									<tr>
										<td>${blackNum }</td>
										<c:set var="blackNum" value="${blackNum-1 }"/>
										<td>${black.suspect }</td>
										<td>${black.victim }</td>
										<td><span class="clickAdmin" onclick="popUpBlack(${black.num})">${black.content }</span></td>											
										<td>${black.reg_date }</td>
									</tr>
								</c:forEach>
							</table>
						</div>
						
						<div class="col-xs-12 col-sm-12 col-md-12 pagings" align="center">
							<div class="form-group">
								<div class="row">
									<div class="col-xs-12">${blackPaging }</div>
								</div>
							</div>
						</div>
					</c:if>
				</div>
					
					
			</div>
		</div>
	</div>
</div>